package electricity.controller.datacontroller;

import electricity.dto.AlarmDto;
import electricity.dto.AlarmQueryDto;
import electricity.result.Result;
import electricity.service.AlarmService;
import electricity.vo.PageResult;

// 替换 SpringFox 为 SpringDoc 注解
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/data")
@Tag(name = "数据检测接口") // 替换了 @Api
@Slf4j
public class DataController {

    @Autowired
    private AlarmService alarmService;




    @GetMapping("/list")
    @Operation(summary = "告警分页查询")
    public Result<PageResult> page(AlarmQueryDto alarmQueryDto) {
        log.info("告警分页查询:{}", alarmQueryDto);
        PageResult pageResult = alarmService.pageQuery(alarmQueryDto);
        return Result.success(pageResult);
    }

    @PutMapping("/processAlarm")
    @Operation(summary = "单个处理告警信息")
    public Result handle(@RequestBody AlarmDto alarmDto) {
        log.info("", alarmDto);
        alarmService.handle(alarmDto);
        return Result.success();
    }
}
